const init = [{
    id: '001',
    name: 'xiaofei',
    age: 18
}]
export default function personReducer(preState = init, action) {
    const {
        type,
        data
    } = action;

    if (type === 'addPerson') {
        //合并新值和原来的值，并返回给store
        return [...preState, data]
    }

    //当什么都没做的时候，默认返回初始值
    return preState;
}